"""
urllib 基本使用
模拟浏览器访问 url
六个方法  read() readline() readlines() getcode() geturl() getheaders()
"""

from urllib import request

url = "http://www.baidu.com"
response = request.urlopen(url)     # <class 'http.client.HTTPResponse'>
content = response.read().decode("utf-8")
print(response.getcode())
print(response.geturl())
print(response.getheaders())
